package com.me.study.javaBasic.dataType;

import org.junit.Assert;
import org.junit.Test;

import java.text.MessageFormat;

/**
 * MessageFormat 测试：消息（String）格式化   <p>
 *  见  https://mp.weixin.qq.com/s/ENKwVqPE1cuOgE51ODJnnw
 *
 * @author ME
 * @date 2021/4/26
 */
public class TestMessageFormat {

    private static final MessageFormat format = new MessageFormat("Hello {0}, I'm {1}");

    @Test
    public void test() {
        Assert.assertEquals("字符串格式化：",
                "Hello Tomcat, I'm 汤姆", format.format(new Object[]{"Tomcat", "汤姆"}));
    }

}
